import { Schemas } from '@/types/domain_models'
import TianzhiJavaGenerator from '.'
import { sep } from 'path'

export function writing(generator: TianzhiJavaGenerator, packageName: string, schemas: Schemas) {
  const tpl = generator.templatePath(`service${sep}service.java.ejs`)

  Object.values(schemas).forEach((schema) => {
    generator.fs.copyTpl(tpl, generator._classFilePath(`service${sep}${schema.upperFirstCamelCaseName}Service.java`), {
      packageName,
      snakeCameName: schema.snakeCameName,
      upperFirstCamelCaseName: schema.upperFirstCamelCaseName,
      camelCaseName: schema.camelCaseName,
      kebabCaseName: schema.kebabCaseName,
      properties: schema.properties,
    })
  })
}
